<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>抽离组件结构</title>
</head>

<body>
    <div id="app">
        <my-header></my-header>
    </div>
</body>
<template id="header">
    <header>
        标题 ： {{msg}} <button @click="add">{{count}}</button>
    </header>
</template>
<script src="lib/vue.js"></script>
<script>
    // 将原本的html结构从注册结构中抽离出成为单独的template标签结构
    Vue.component("my-header", {
        template: "#header",
        data() {
            return {
                msg: "huguo",
                count: 1000
            }
        },
        methods: {
            add() {
                this.count += 10000000
            }
        }
    })
    new Vue({
        el: "#app",
        dta: {

        }
    })
</script>

</html>